home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3987 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: strauss.udel.edu!not-for-mail
  2. From: jcorig@strauss.udel.edu (John Pat Corigliano)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: ds.l
  5. Date: 15 Feb 1996 00:15:58 -0500
  6. Organization: University of Delaware
  7. Message-ID: <4fufie$8s7@strauss.udel.edu>
  8. References: <497.6609T1129T586@mbox3.swipnet.se>
  9. NNTP-Posting-Host: strauss.udel.edu
  10.  
  11. In article <497.6609T1129T586@mbox3.swipnet.se>,
  12. Patrik Nilsson <patrik.nilsson@mbox3.swipnet.se> wrote:
  13. >When using FileInfoBlock it must be long word aligned.
  14. >Q: In asm you have 'ds.l'. Is there any equal in C?
  15.  
  16. You have a few ways:
  17.  
  18. 1. Use AllocDosObject() - this is guaranteed to be aligned
  19. properly.
  20.  
  21. 2. If using SAS, use the __aligned keyword when declaring
  22. the structure.
  23.  
  24. 3. I'm fairly certain AllocMem is long-word aligned, but
  25. I could be wrong...
  26.  
  27. 4. As a last resort, do it the ugly way :)
  28.  
  29.     UBYTE buffer[sizeof(struct FileInfoBlock) + 3];
  30.     struct FileInfoBlock *fib;
  31.  
  32.     fib = (struct FileInfoBlock *)buffer;
  33.     while ((ULONG)fib & 0x3) ((ULONG)fib)++;
  34.  
  35. This wastes some memory, but it works ;)
  36.  
  37. Later,
  38. -- 
  39. John Corigliano                                  jcorig@strauss.udel.edu
  40. Computer and Information Science                  University of Delaware
  41. --
  42. "Never drive a car when you're dead."  - Tom Waits
  43.